import {NgModule} from "@angular/core";
import {RouterModule, Routes} from "@angular/router";
import {SharedModule} from "../../shared/shared.module";

import {NewsListComponent} from "./news-list/news-list.component";
import {NewsDetailComponent} from "./news-detail/news-detail.component";
import {NewsEditComponent} from "./news-edit/news-edit.component";

const routes: Routes = [
    {path: '', redirectTo: ' news'},
    {path: 'news', children: [
        {path: '', redirectTo: 'list'},
        {path: 'list', component: NewsListComponent},
        {path: 'add', component: NewsEditComponent},
        {path: 'modify/:code', component: NewsEditComponent},
        {path: 'detail/:code', component: NewsDetailComponent}
    ]}
];

@NgModule({
  imports: [
    SharedModule.forRoot(),
    RouterModule.forChild(routes)
  ],
  declarations: [
    NewsListComponent,
    NewsDetailComponent,
    NewsEditComponent
  ],
  providers: []
})
export class NewsModule {
}
